--- this function overrides the RaidPulloutButton_OnEvent function for personal targets
function RaidFramesPlus_PersonalTargetUpdate(self, event, ...)
	local speaker = self.speaker
	if ( event == "PLAYER_ENTERING_WORLD" ) then
		RaidPulloutButton_UpdateVoice(self)
	elseif ( event == "UNIT_HEALTH" ) then
		local arg1 = ...;
		if ( arg1 == self.unit ) then
			ChatFrame1:AddMessage(event)
			local name = UnitName(self.unit)
			local class, fileName = UnitClass(self.unit)
			local isDead = UnitIsDeadOrGhost(self.unit)
			local online = UnitIsConnected(self.unit)
			if ( online ) then
				RaidPulloutButton_UpdateDead(self, isDead, fileName)
			end
			securecall("UnitFrameHealthBar_Update", self.healthbar, self.unit)

		end
	elseif ( event == "UNIT_AURA" ) then
		-- suppress while ready check is up
		local arg1 = ...
		if ( arg1 == self.unit ) then
			if ( not _G[self:GetName().."ReadyCheck"]:IsShown() ) then
				RefreshAuras(self, self.unit, MAX_RAID_AURAS, "Aura", true, self:GetParent().showBuffs)
			end
		end
	elseif ( event == "VOICE_START") then
		local arg1 = ...
		if ( arg1 == (self.secondaryUnit or self.unit) ) then
			speaker.timer = nil
			speaker:Show()
			UIFrameFadeIn(speaker, 0.2, speaker:GetAlpha(), 1)
			if ( not self.muted ) then
				VoiceChat_Animate(speaker, 1)
			end
		end
	elseif ( event == "VOICE_STOP" ) then
		local arg1 = ...;
		if ( arg1 == (self.secondaryUnit or self.unit) ) then
			speaker.timer = VOICECHAT_DELAY;
			VoiceChat_Animate(speaker, nil)
			if ( self.muted ) then
				speaker:Show()
			else
				UIFrameFadeOut(speaker, 0.2, speaker:GetAlpha(), 0)
			end
		end
	elseif ( event == "VOICE_STATUS_UPDATE" ) then
		RaidPulloutButton_UpdateVoice(self)
	elseif (( event == "UNIT_ENTERED_VEHICLE" ) or ( event == "UNIT_EXITED_VEHICLE" )) then
		local arg1 = ...
		if ( arg1 == (self.secondaryUnit or self.unit) ) then
			if ( UnitHasVehicleUI(arg1) ) then
				self.vehicleIndicator:Show()
			else
				self.vehicleIndicator:Hide()
			end
			RaidPulloutButton_UpdateSwapFrames(self, arg1)
		end
	end
end

function test()
	UIParentLoadAddOn("Blizzard_RaidUI")
	CreateFrame("BUTTON", "ptarget", UIParent, "RaidPulloutButtonTemplate")
	ptarget.unit = "player"
	ptarget.nameLabel:SetText(UnitName(ptarget.unit))
	ptarget:SetPoint("CENTER")
	ptarget:RegisterEvent("PLAYER_ENTERING_WORLD")
	ptarget:RegisterEvent("UNIT_HEALTH")
	ptarget:RegisterEvent("UNIT_MANA")
	ptarget:RegisterEvent("UNIT_AURA")
	ptarget:SetScript("OnEvent", RaidFramesPlus_PersonalTargetUpdate)
	ptarget:Show()
	ptargetClearButton:RegisterForClicks("AnyDown", "AnyUp")
	ptargetClearButton:SetAttribute("type", "target")
	ptargetClearButton:SetAttribute("unit", ptarget.unit)
	SecureUnitButton_OnClick(ptarget)
	securecall("UnitFrameHealthBar_Initialize", ptarget.unit, ptarget.healthbar, nil, true)
	securecall("UnitFrameHealthBar_Update", ptarget.healthbar, ptarget.unit)
	 
end 